﻿<sdk:Page xmlns:my2="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.RainierOrange" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" xmlns:Converter="clr-namespace:Cooking.Client.Converter" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:Cooking_Client_Common="clr-namespace:Cooking.Client.Common" x:Class="Cooking.Client.Views.SearchView"
           mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
           Title="Search Page">
    <sdk:Page.Resources>
        <Converter:RatingConverter x:Key="RatingConverter"/>
    </sdk:Page.Resources>
        <Grid x:Name="LayoutRoot">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="218" />
                <ColumnDefinition Width="422*" />
            </Grid.ColumnDefinitions>
            <StackPanel Height="Auto" HorizontalAlignment="Stretch" x:Name="stackPanel1" VerticalAlignment="Stretch" Width="Auto" Margin="8" Orientation="Vertical">
                <sdk:Label Height="28" x:Name="label1" Width="120" HorizontalContentAlignment="Center" Content="Title contains..." FontWeight="Normal" Margin="0,10,0,0" />
                <TextBox Height="23" x:Name="PartialTitle" Width="184" HorizontalAlignment="Center" VerticalAlignment="Stretch" Padding="0" >
                	<i:Interaction.Triggers>
                		<i:EventTrigger EventName="KeyDown">
                			<Cooking_Client_Common:TextBoxEnterButtonInvoke TargetName="FindRecipes"/>
                		</i:EventTrigger>
                	</i:Interaction.Triggers>
                </TextBox>
                <sdk:Label Height="28" x:Name="label2" Width="184" HorizontalContentAlignment="Center" FontWeight="Normal" Content="Description contains..." Margin="0,10,0,0" />
                <TextBox Height="23" x:Name="PartialDescription" Width="184" >
                	<i:Interaction.Triggers>
                		<i:EventTrigger EventName="KeyDown">
                			<Cooking_Client_Common:TextBoxEnterButtonInvoke TargetName="FindRecipes"/>
                		</i:EventTrigger>
                	</i:Interaction.Triggers>
                </TextBox>
                <sdk:Label Height="28" x:Name="label3" Width="Auto" Margin="0,10,0,0" HorizontalContentAlignment="Center" Content="Minimum rating" />
                <toolkit:Rating Height="Auto" ItemCount="5" x:Name="MinimumRating" Width="102" IsEnabled="True" HorizontalContentAlignment="Center" UseLayoutRounding="True" Background="{x:Null}" />
                <Button Content="Find Recipes" Height="30" x:Name="FindRecipes" Width="184" Margin="0,10,0,0"  />
                <Button Content="Add New Recipe" Height="30" x:Name="AddNewRecipe" Width="184" Margin="0,10,0,0" />
            </StackPanel>
            <Grid Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White">
                <sdk:DataGrid x:Name="Recipes" AutoGenerateColumns="False" Height="Auto" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Stretch" Width="Auto" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" 
                              RowDetailsVisibilityMode="VisibleWhenSelected" >
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Binding="{Binding Title}" CanUserReorder="False" CanUserResize="True" CanUserSort="True" Header="Title" Width="3*" Foreground="Black" IsReadOnly="True" d:IsHidden="True" />
                        <sdk:DataGridTemplateColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="1*" Header="Rating" d:IsHidden="True">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <toolkit:Rating Value="{Binding Rating, ConverterParameter=5, Converter={StaticResource RatingConverter}, Mode=TwoWay}" ItemCount="5" Height="Auto" />
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                    </sdk:DataGrid.Columns>
                    <sdk:DataGrid.RowDetailsTemplate>
                        <DataTemplate>
                            <StackPanel >
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="Description:" Foreground="Black"/>
                                    <TextBlock Text="{Binding Description}" Foreground="Black"/>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </sdk:DataGrid.RowDetailsTemplate>
                </sdk:DataGrid>
            </Grid>
        </Grid>
</sdk:Page>
